UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SSFXtDBpxsOhCBMb28nzjngR5nsUpPY229gx2dUnTVg=' 
WHERE 
  key_id = 'b5efa7350c2edc17134da21eac5a686a93e50109337ec2930a2560668bb5309b' 
  AND (
    token = 'SSFXtDBpxsOhCBMb28nzjngR5nsUpPY229gx2dUnTVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027