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

Query time 0.00034