UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e3t3I67emdzjcW82SPqs/EHpdi5g/s0dcxcqcA836xs=' 
WHERE 
  key_id = 'b77afaf3e67d5e1f34be812c4c6462b6c4185056eede9b8faafc1b5c3ffab467' 
  AND (
    token = 'e3t3I67emdzjcW82SPqs/EHpdi5g/s0dcxcqcA836xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041