UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JxKPA6boEmLziENMcrSEDGs21S2a1SRgAv0n9WjFFMw=' 
WHERE 
  key_id = 'c2f5cfc92e7572a869784bf89b173b5bdd25a86a456951b4fc0da8c2fb073bf9' 
  AND (
    token = 'JxKPA6boEmLziENMcrSEDGs21S2a1SRgAv0n9WjFFMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016