UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5y0rjh8ViBBJKOzqGGdSk1KsPQuPmN17u7Q7IxmS1xo=' 
WHERE 
  key_id = 'fa5acfdf3b6d08e5897234b85caf4a1f24db014f0e123b945784817fa29fbfe2' 
  AND (
    token = '5y0rjh8ViBBJKOzqGGdSk1KsPQuPmN17u7Q7IxmS1xo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030