UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '27BDSXik2QCyzrQwh5geL+QdlcFD2txNusa+0Gl3Hyo=' 
WHERE 
  key_id = 'b652d8b5ca53b2a97892d241f8348f551f7c54b231642d32b967249608e9779f' 
  AND (
    token = '27BDSXik2QCyzrQwh5geL+QdlcFD2txNusa+0Gl3Hyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032