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