UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G274uiOkQVOa+2griD5/IjBb6Jt6XrilbM684bHxNzs=' 
WHERE 
  key_id = 'd9b44fb23ca7c202ae63a9dc564fd65877efa927ae5dc0539b0c991c93d4ad76' 
  AND (
    token = 'G274uiOkQVOa+2griD5/IjBb6Jt6XrilbM684bHxNzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030