UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VE/ShfaCqtFZVrIb6dWisZSbxFW/QkpKTIs3bEQaXbI='
WHERE
key_id = 'c5cf8a0a66facdaebd3a2047638349df4f04175720cc58e48e0aad352c2dfa5d'
AND (
token = 'VE/ShfaCqtFZVrIb6dWisZSbxFW/QkpKTIs3bEQaXbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)