UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BN5GPSRnKMclG+G6R4PCKypd8NgCM2+mkfAsBKjyUQE=' 
WHERE 
  key_id = 'e958c1aad523631c06e7aa05216bb595c9ad4b09ab5b30fc78caa2a68e24b010' 
  AND (
    token = 'BN5GPSRnKMclG+G6R4PCKypd8NgCM2+mkfAsBKjyUQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044