UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Q0S5M4xZ5vfDClCWy+POdefZN9cxMhk7fDhgukXJms='
WHERE
key_id = 'f5ada111af8b33535ea164da19f4fe6fd32ac1d74b7c3b29726223c71c4df44d'
AND (
token = '4Q0S5M4xZ5vfDClCWy+POdefZN9cxMhk7fDhgukXJms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)