UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cf5Z0bBKF/GC2FD27j/KXzG8hlhXr/h4ZPEfMQ9hosU=' 
WHERE 
  key_id = 'a2dcb3da85a1890cf9f166af2ba03bd28ea1d177044cf869733143acc2b3d263' 
  AND (
    token = 'cf5Z0bBKF/GC2FD27j/KXzG8hlhXr/h4ZPEfMQ9hosU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024