UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bIoju49lyJQgo1p55OAcn8tVj9BU/TDnAVDvekkXD9o=' 
WHERE 
  key_id = 'dde6ee90b008a2faf95fa06fdb9fa1f3837181952f527effd3482c3895451825' 
  AND (
    token = 'bIoju49lyJQgo1p55OAcn8tVj9BU/TDnAVDvekkXD9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029