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