UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L71ljP2W0M+puYU78jJK9gztcJaTsfbLrp2Ib937M+Y=' 
WHERE 
  key_id = '51598ec14d85df1c4073b060b681b891e1f6688568bcaba6ed6c9a12c8983f82' 
  AND (
    token = 'L71ljP2W0M+puYU78jJK9gztcJaTsfbLrp2Ib937M+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028