UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p1iGrpqwOydiQKHeD1VeQjOD/Yr5n9PLTuDK/CwjIus=' 
WHERE 
  key_id = '7b4d80c7d7d0e60b345b1fa3f9218b301c0a80195cc5a619c3ad7b277f162f91' 
  AND (
    token = 'p1iGrpqwOydiQKHeD1VeQjOD/Yr5n9PLTuDK/CwjIus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018