UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'secjTJmhTqmPzoqO+d689kTTm7UoXk8PuS+SKOmYmvA=' 
WHERE 
  key_id = 'a95723ef30d2868273e77fe457490cd0b884d9a927be4c6cdaaf60a100a430f9' 
  AND (
    token = 'secjTJmhTqmPzoqO+d689kTTm7UoXk8PuS+SKOmYmvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033