UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kFtY6NRZ5/yrSCOwEOJjpOTllqojAvo6tIXDpf1PFoc=' 
WHERE 
  key_id = '70d31eeb40733f46c21e7c774a2852d73238d7cafffb36c6880fc393961fb667' 
  AND (
    token = 'kFtY6NRZ5/yrSCOwEOJjpOTllqojAvo6tIXDpf1PFoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040