UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jivl0ZcX6GID5wiZ2L+kYIji9uzGG1yB0detD3MDHZU='
WHERE
key_id = '51330f4f0c16d643467db423dfd888dc5f949bb486611fd58f85139aa22ef827'
AND (
token = 'Jivl0ZcX6GID5wiZ2L+kYIji9uzGG1yB0detD3MDHZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)