UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gvA6m8549NZmVzbZ+PVvNTJUmgspcm1o1Zv5DoCKWjo='
WHERE
key_id = 'ccccb6d1c9d519d0aa3779f762c2c1833d8d16de136951cb6e7046068111f300'
AND (
token = 'gvA6m8549NZmVzbZ+PVvNTJUmgspcm1o1Zv5DoCKWjo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)