UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NRLSysposFs7DH9uqqwC3AcPjcqOq+8XO5t4kXPciBQ=' 
WHERE 
  key_id = '826aaf6783dd089bcc3b1ac58612e5ffe0ed7dd517888382e8502c3e139f1081' 
  AND (
    token = 'NRLSysposFs7DH9uqqwC3AcPjcqOq+8XO5t4kXPciBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022