UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0ZOiw1QocUw81rA1yF1wwxAGUrJ+GnrHFjrdjcQ6ZQI=' 
WHERE 
  key_id = 'd58b1527e2a1bcd917a54da60568f6e2fe7c2a04e648cf1bdb886db9ff968a70' 
  AND (
    token = '0ZOiw1QocUw81rA1yF1wwxAGUrJ+GnrHFjrdjcQ6ZQI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053