UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v00iMtBNLESNWczrKAJTlnIRekOjKeE0tc87IdCcpVU='
WHERE
key_id = 'f8c23cdbeeb027e80765862f1868a355a74e680f9c4ecbcf08006a5700a081b1'
AND (
token = 'v00iMtBNLESNWczrKAJTlnIRekOjKeE0tc87IdCcpVU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)