UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J1BZ/SBCJXBk6g4k+vmQ/2D9ZKLlXf1YviDgA2xT+bw='
WHERE
key_id = 'e18037bd126df52628f186638227fecb6d5cce3742fc510d72c16327a02d2a5c'
AND (
token = 'J1BZ/SBCJXBk6g4k+vmQ/2D9ZKLlXf1YviDgA2xT+bw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)